<template>
	<view>
		
		<cu-custom  :bgColor="'bg-'+$themeColor()">
			<block slot="content">专家</block>
		</cu-custom>
		
		
		<scroll-view scroll-x class="bg-black nav text-center">
			<view class="cu-item" :class="index==TabCur?'text-white cur':''" v-for="(item,index) in 2" :key="index" @tap="tabSelect" :data-id="index">
				{{projectNameList[index]}}
			</view>
		</scroll-view>
		
		<!-- <view class="cu-bar tabbar bg-black fixed  shadow top projectInfoTab">
			<view class="action" @click="NavChange('expert')" data-cur="expert">
				<view :class="PageCur=='expert'?'text-green':'text-gray'">专家列表</view>
			</view>
			<view class="action" @click="NavChange('recordList')" data-cur="recordList">
				<view :class="PageCur=='recordList'?'text-green':'text-gray'">抽取记录</view>
			</view>
		
		</view> -->
		<view class="projectConet">
			<expert v-if="PageCur=='expert'"></expert>
			<recordList v-if="PageCur=='recordList'"></recordList>
		</view>
	</view>
</template>
<script>
	import {mapState} from 'vuex';
	
	export default {
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		data() {
			return {
				id:'',
				projectName:'',
				PageCur: 'expert',
				TabCur: 0,
				scrollLeft: 0,
				projectNameList:['专家列表','抽取记录'],
			}
		},
		onLoad: function(options) {
			this.id = options.id;
			this.projectName = options.projectName;
			
		},
		mounted() {
			// 初始化加载
			 // console.log(this.hasLogin)
			if( !this.hasLogin){
				// 如果没有登录，则跳转到登录页面
				uni.navigateTo({
					url:"../login/login"
				})
			}
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
				this.req();
			},
			req(){
				if(this.TabCur==0){
					this.NavChange("expert");
				}else if(this.TabCur==1){
					this.NavChange("recordList");
				}
			},
			NavChange: function(e) {
				 this.PageCur = e;
			}
		}
	}
</script>

<style>
.cu-form-group .title {
		min-width: calc(4em + 15px);
	}
	.projectConet {
		margin-top: 40px;
	}
	/* .cu-bar {
		margin-top: 40px;
		padding-top: 0px;
	} */
</style>
